home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group92c.txt / 000097_icon-group-sender _Wed Nov 25 08:48:11 1992.msg < prev    next >
Internet Message Format  |  1993-01-04  |  27KB

  1. Received: by cheltenham.cs.arizona.edu; Wed, 25 Nov 1992 12:28:48 MST
  2. Date: 25 Nov 1992 08:48:11 -0600 (CST)
  3. From: Chris Tenaglia - 257-8765 <TENAGLIA@mis.mcw.edu>
  4. Subject: HOLIDAY GAME OFFERING
  5. To: icon-group@cs.arizona.edu
  6. Message-Id: <01GRK95P6NRM8WWAXD@mis.mcw.edu>
  7. Organization: Medical College of Wisconsin (Milwaukee, WI)
  8. X-Vms-To: IN%"icon-group@cs.arizona.edu"
  9. Mime-Version: 1.0
  10. Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
  11. Content-Transfer-Encoding: 7BIT
  12. Status: R
  13. Errors-To: icon-group-errors@cs.arizona.edu
  14.  
  15.  
  16. I keeping with my self proclaimed tradition of offering icon games on the
  17. holidays here's a little something. It's a horse race game. I've run it
  18. on VAX/VMS (icon 8.7), UNIX (icon 8.7), and MS-DOS (icon 8.5). It uses
  19. ansi sequences for screen management, so I expect to get flamed there.
  20. In fact if run on a PC, ansi.sys should be loaded through config.sys.
  21. It's not intended to be production quality, but rather as a sample of
  22. icon programming. I am trying to improve commenting to make it easier for
  23. others to figure out. Perhaps some of the adventurous may want to improve it.
  24. I think it's fun. Enjoy!
  25.                                 | Ce que vous voyes est ce que vous obtenez.
  26. Chris Tenaglia (System Manager) | Medical College of Wisconsin
  27. 8701 W. Watertown Plank Rd.     | Milwaukee, WI 53226
  28. (414)257-8765                   | tenaglia@mis.mcw.edu, mcwmis!tenaglia
  29.  
  30. #
  31. # FILE : HR.ICN    
  32. # DESC : HORSE RACE GAME WRITTEN IN ICON
  33. # DATA : HORSES : LINE1 = HORSE NAME
  34. #                 LINE2 = ODDS
  35. #                 LINE3.= ASCII PICTURE
  36. #
  37. # UPDATE        BY         WHAT
  38. # 07-NOV-1992   TENAGLIA   INITIAL WRITE
  39. # 08-NOV-1992   TENAGLIA   PERFECTED THE ARITHMETIC
  40. # 13-NOV-1992   TENAGLIA   SOME FINISHING TOUCHES
  41. # 15-NOV-1992   TENAGLIA   THROW IN POTENTIAL ACCIDENTS
  42. #
  43.  
  44. global horse1, horse2, horse3,                 # horses are global
  45.        players, money, bets,                   # player info is global
  46.        vectors, leg1,  leg2, leg3,             # track parameters
  47.        front,   back,  y1  , y2,   y3,         # horse parameters
  48.        pos1,    pos2,  pos3,                   # more horse parameters
  49.        oops1,   oops2, oops3                   # accident flags
  50.  
  51. ######################################################################
  52.  
  53. procedure main()
  54.  
  55. banner()
  56. if ready() == "no" then stop("Game Over.")     # ask if ready
  57. players := get_players()                       # get player name list
  58. money   := table(100)                          # everyone starts w/$100
  59. &random := map(&clock,":","0")                 # randomize
  60.  
  61. repeat
  62.   {
  63.   if ready() == "no" then break
  64.   writes("\e[2J\e[H")                          # clear old junk off screen
  65.   repeat                                       # CHOOSE 3 FRESH HORSES
  66.     {
  67.     horse1  := get_horse()                     # get first horse list
  68.     horse2  := get_horse()                     # get second horse list
  69.     horse3  := get_horse()                     # get third horse list
  70.     if horse1[1] == horse2[1] |                # disallow duplicates
  71.        horse2[1] == horse3[1] |                # because a horse can't
  72.        horse3[1] == horse1[1] then next        # race against himself
  73.     break                                      # continue...
  74.     }
  75.   bets   := get_bet()                          # bets initially 0
  76.   winner := race()                             # race the horses, get winner
  77.   pay(winner)                                  # pay winner(s) if any
  78.   }
  79. done()
  80. end
  81. #
  82. #
  83. # ask if ready to play the game, return yes or no
  84. #
  85. procedure ready()
  86.   static  pass,sh
  87.   initial {
  88.           pass := 0                # initialize pass counter
  89.           sh   := "\e[1;7m \e[0;1;33;44m"   # initialize a shadow for box
  90.           }
  91.   if (pass +:= 1) = 1 then
  92.     {
  93.     writes("\e[0;1;33;44m\e[2J\e[H")
  94.     write(" +----------------------------------------------------------+")
  95.     write(" |          WELCOME TO ICON PARK VIRTUAL RACE TRACK         |",sh)
  96.     write(" |                                                          |",sh)
  97.     write(" |   The following game allow one or more players to bet on |",sh)
  98.     write(" |   three Cyberspace steeds that will run on an ANSI VT100 |",sh)
  99.     write(" |   dirt track. Of course the bets are Cyberspace dollars, |",sh)
  100.     write(" |   which have no real world value. We use only the oldest |",sh)
  101.     write(" |   escape sequences to condition the track surface, which |",sh)
  102.     write(" |   may not appeal  to TEK crowds,  and I'm sure some fans |",sh)
  103.     write(" |   will hurl curses. C'est la vie!                        |",sh)
  104.     write(" |                                                          |",sh)
  105.     write(" +----------------------------------------------------------+",sh)
  106.     write("  \e[1;7m                                                            \e[0;1;33;44m")
  107.     write("")
  108.     write("    Are we ready to enter our names, and begin?")
  109.     answer := map(input("Enter yes or no:"))
  110.     if answer[1] == "n" then return "no" else return "yes"
  111.     }
  112.   end
  113.  
  114. #
  115. # get the names of the players
  116. #
  117. procedure get_players()
  118.   people  := []
  119.   counter := 1
  120.   write("\nEnter Player Names. Enter blank when done.")
  121.   repeat
  122.     {
  123.     (who := input("  Player #" || counter || ":")) | break
  124.     if trim(who) == "" then break
  125.     put(people,who)
  126.     counter +:= 1
  127.     }
  128.   if *people < 1 then stop("Not enough players. Need at least one.")
  129.   return people
  130.   end
  131. #
  132. #
  133. # build a horse list structure
  134. #
  135. procedure get_horse()
  136.   static  stable,photos
  137.   initial {
  138.           photos := [pick1(),pick2(),pick3(),
  139.                      pick4(),pick5(),pick6()]
  140.           stable := ["Incredible Hash",
  141.                      "Random Number",
  142.                      "Floppy Crash",
  143.                      "RAM Dump",
  144.                      "Programmers Nightmare",
  145.                      "Spaghetti Code",
  146.                      "Infinite Loop",
  147.                      "User Blues",
  148.                      "See Plus Plus",
  149.                      "Press Any Key",
  150.                      "Paradigm Shift",
  151.                      "Adricks' Abend",
  152.                      "Client Server",
  153.                      "Network Storm",
  154.                      "Mr. Cobol",
  155.                      "Forgotten Password",
  156.                      "Hackers' Byte",
  157.                      "Chad Hollerith",
  158.                      "ASCII Question",
  159.                      "EBCDIC Object",
  160.                      "Recursive Instance",
  161.                      "RunTime Error"]
  162.           }
  163.   name := ?stable                      # pick a horse name
  164.   odds := 1 + real((?30)/real(10.0))   # calculate the odds
  165.   tmp  := ?photos                      # choose a photo file
  166.   pic  := [name,odds]
  167.   every put(pic,!tmp)
  168.   return pic
  169.   end
  170. #
  171. #
  172. # obtain bets from the players
  173. #
  174. procedure get_bet()
  175.   (&features == "MS-DOS") | writes("\e[?25h")
  176.   bets := table(0)
  177.   summation    := 0
  178.   every person := !players do
  179.     {
  180.     if money[person] <= 0 then next
  181.     summation +:= money[person]
  182.     write("\e[2J\e[H",person,", enter your bet. You have $",money[person],"\n")
  183.     write("1. ",left(horse1[1],32)," odds = ",horse1[2]," : 1")
  184.     write("2. ",left(horse2[1],32),"   \"  = ",horse2[2]," : 1")
  185.     write("3. ",left(horse3[1],32),"   \"  = ",horse3[2]," : 1")
  186.     write("\n       (enter 5 on 2 for $5 on ",horse2[1],")\n")
  187.     wager := trim(map(input("Your decision : ")))
  188.     if wager == "" then next
  189.     if wager == "q" then done()
  190.     items := parse(wager,' ')
  191.     if not(numeric(items[1])) | not(numeric(items[3])) then
  192.       {
  193.       input("\7Wager Improperly Entered. No wager made. Press RETURN")
  194.       next
  195.       }
  196.     if (*items ~= 3)              |
  197.        (items[2] ~== "on")        |
  198.        (items[1] > money[person]) |
  199.        (1 > items[3] > 3)         then
  200.          {
  201.          input("\7Wager Improperly Entered. No wager made. Press RETURN")
  202.          next
  203.          }
  204.     bets[person]   := wager
  205.     money[person] -:= parse(wager,' ')[1]
  206.     }
  207.   if summation = 0 then
  208.     {
  209.     write("\e[2J\e[HICON PARK CYBER RACE TRACK BIDS YOU ADIEU\n")
  210.     write("It looks you'all lost all your money here today.")
  211.     write("Take it easy now. Better luck next time")
  212.     stop("Game Over")
  213.     }
  214.   input("Done Entering Wagers. Press RETURN to Continue.")
  215.   end
  216. #
  217. #
  218. # determine the victor and pay out winnings. if there is a tie
  219. # then nothing gets payed out (bets are refunded)
  220. #
  221. procedure pay(victor)
  222.   (&features == "MS-DOS") | writes("\e[?25h")          # turn on cursor again
  223.   winner := case victor of
  224.     {
  225.     1 : horse1
  226.     2 : horse2
  227.     3 : horse3
  228.     default : ["tie"]
  229.     }
  230.   if victor = 4 then
  231.     {
  232.     writes(at(12,14),"All The Steeds Fell Down! Too many injuries!\7")
  233.     wait(1)
  234.     writes(at(12,14),"The judges are coming to a decision....")
  235.     wait(2)
  236.     writes(at(12,14),"All bets will be refunded. Sorry.......")
  237.     check := sort(bets,1)
  238.     every pair := !check do
  239.       {
  240.       name         := pair[1]
  241.       wager        := pair[2]
  242.       odds         := winner[2]
  243.       prize        := parse(bets[name],' ')[1]
  244.       money[name] +:= integer(prize)
  245.       }
  246.     test := map(input(at(13,1) || "Press RETURN to Continue."))
  247.     if test[1] == "q" then done()
  248.     return
  249.     }
  250.   if winner[1] == "tie" then
  251.     {
  252.     writes(at(12,14),"It was a photo finish!\7")
  253.     wait(1)
  254.     writes(at(12,14),"The judges are coming to a decision....")
  255.     wait(2)
  256.     writes(at(12,14),"All bets will be refunded. Sorry.......")
  257.     check := sort(bets,1)
  258.     every pair := !check do
  259.       {
  260.       name         := pair[1]
  261.       wager        := pair[2]
  262.       odds         := winner[2]
  263.       prize        := parse(bets[name],' ')[1]
  264.       money[name] +:= integer(prize)
  265.       }
  266.     test := map(input(at(13,1) || "Press RETURN to Continue."))
  267.     if test[1] == "q" then done()
  268.     return
  269.     } else {
  270.     writes(at(12,14),winner[1],"   WINS!                              ")
  271.     writes(at(victor+21,1),"\e[1;5;33;44m",victor,"  : ",left(winner[1],32),"\e[0;1;33;44m")
  272.     wait(2)
  273.     writes(at(12,14),"And now for a closeup of the winner....")
  274.     wait(3)
  275.     y := 4
  276.     writes(at((y+:=1),40),"+",repl("-",35),"+")
  277.     every i := 3 to *winner do
  278.       writes(at((y+:=1),40),"|",left(winner[i],35),"|")
  279.     writes(at(y,40),"+",repl("-",35),"+")
  280.     }
  281.   check := sort(bets,1)
  282.   every pair := !check do
  283.     {
  284.     name  := pair[1]
  285.     wager := pair[2]
  286.     nag   := parse(wager,' ')[3]
  287.     if nag = victor then
  288.       {
  289.       odds         := winner[2]
  290.       prize        := odds * parse(bets[name],' ')[1]
  291.       money[name] +:= integer(prize)
  292.       }
  293.     }
  294.   test := map(input(at(13,1) || "Press RETURN to Continue."))
  295.   if test[1] == "q" then
  296.     {
  297.     #
  298.     # evaluate results from todays races
  299.     #
  300.     write("\e[2J\e[HICON PARK CYBER RACE TRACK BIDS YOU ADIEU\n")
  301.     write("    We all started with $100. And now for the results...\n")
  302.     every player := !players do
  303.       {
  304.       winnings := money[player]
  305.       if winnings < 100 then msg := "Looks like you lost some $ today."
  306.       if winnings = 0   then msg := "Lost all your money today."
  307.       if winnings = 100 then msg := "Looks like you broke even today."
  308.       if winnings > 100 then msg := "Looks like a winner. Stop at the IRS window please!"
  309.       if winnings > 300 then msg := "Wow! The IRS agent will escort you to his office."
  310.       write("OK ",player,", you have $",winnings," left. ",msg)
  311.       }
  312.     }
  313.   end
  314. #
  315. #
  316. # run the race and return the winning horse # (1, 2, or 3)
  317. #
  318. procedure race()
  319.   vectors := draw_track()
  320.   #
  321.   # set up starting positions
  322.   #
  323.   pos1  := 1
  324.   pos2  := 1
  325.   pos3  := 1
  326.   
  327.   #
  328.   # select lanes to run in
  329.   #
  330.   y1    := 5
  331.   y2    := 7
  332.   y3    := 9
  333.  
  334.   #
  335.   # set up for the legs of the race, 3 normal + 3 accidentsal
  336.   #
  337.   leg1  := 1
  338.   leg2  := 1
  339.   leg3  := 1
  340.  
  341.   #
  342.   # set up accident multipliers
  343.   #
  344.   oops1 := 1
  345.   oops2 := 1
  346.   oops3 := 1
  347.  
  348.   #
  349.   # designate vector milestones, marking legs of the race
  350.   #
  351.   diamx   := 68
  352.   diamy   := 10
  353.   finish  := 146
  354.   
  355.   #
  356.   # design horse bodies from different vantage points
  357.   #
  358.   front    := list(6)
  359.   front[1] := "#^"
  360.   front[2] := "V"
  361.   front[3] := "#'  "
  362.   front[4] := "_X  "
  363.   front[5] := "X"
  364.   front[6] := "_X  "
  365.  
  366.   back     := list(6)
  367.   back[1]  := "  `#"
  368.   back[2]  := "/"
  369.   back[3]  := "^#"
  370.   back[4]  := "  X_"
  371.   back[5]  := "X"
  372.   back[6]  := "  X_"
  373.  
  374.   #
  375.   # display the starting positions and fire the gun to begin!
  376.   #
  377.     (&features == "MS-DOS") | writes("\e[?25l")         # deactivate cursor
  378.     writes(at(5,1),back[1],1,front[1])                  # horse 1
  379.     writes(at(22,6),left(horse1[1],32)," / ",horse1[2]," : 1 / ")
  380.  
  381.     writes(at(7,1),back[1],2,front[1])                  # horse 2
  382.     writes(at(23,6),left(horse2[1],32)," / ",horse2[2]," : 1 / ")
  383.  
  384.     writes(at(9,1),back[1],3,front[1])                  # horse 3
  385.     writes(at(24,6),left(horse3[1],32)," / ",horse3[2]," : 1 / ")
  386.  
  387.     writes(at(12,14),"ON YOUR MARK...  GET SET...")
  388.     wait(1)
  389.     writes("\7",at(12,14),"AND THEY'RE OFF!                           ")
  390.   #
  391.   # run the race
  392.   #
  393.   repeat
  394.     {
  395.     case &features of
  396.         {
  397.         "VMS" : delay(500)                    # delay 10,000/sec VMS
  398.         "UNIX": delay(50)                     # delay  1,000/sec UNIX
  399.         default : platform := &features       # not on DOS icon 8.5
  400.         }
  401.     inc1    := ?3-1 * oops1
  402.     if oops1 = 1 then pos1 +:= inc1
  403.  
  404.     inc2    := ?3-1 * oops2
  405.     if oops2 = 1 then pos2 +:= inc2
  406.  
  407.     inc3    := ?3-1 * oops3
  408.     if oops3 = 1 then pos3 +:= inc3
  409.  
  410.     if (pos1 >= 68) & (leg1 = 1) then leg1 := 2
  411.     if (pos2 >= 68) & (leg2 = 1) then leg2 := 2
  412.     if (pos3 >= 68) & (leg3 = 1) then leg3 := 2
  413.     if (pos1 > 78)  & (leg1 = 2) then leg1 := 3
  414.     if (pos2 > 78)  & (leg2 = 2) then leg2 := 3
  415.     if (pos3 > 78)  & (leg3 = 2) then leg3 := 3
  416.  
  417.     if (78 >= pos1 >= 68) then y1 +:= inc1
  418.     if (78 >= pos2 >= 68) then y2 +:= inc2
  419.     if (78 >= pos3 >= 68) then y3 +:= inc3
  420.  
  421.     if y1 > 15 then y1 := 15
  422.     if y2 > 17 then y2 := 17
  423.     if y3 > 19 then y3 := 19
  424.  
  425.     result := accident()
  426.     display()
  427.  
  428.     if result = 0 then  return 4
  429.     if (pos1 >= finish) & (pos2 < finish) & (pos3 < finish) then return 1
  430.     if (pos2 >= finish) & (pos1 < finish) & (pos3 < finish) then return 2
  431.     if (pos3 >= finish) & (pos1 < finish) & (pos2 < finish) then return 3
  432.  
  433.     if (pos1 >= finish) & (pos2 >= finish) |
  434.        (pos2 >= finish) & (pos3 >= finish) |
  435.        (pos3 >= finish) & (pos1 >= finish) then return 0
  436.     }
  437.   end
  438. #
  439. #
  440. # display the horses at different legs of the race
  441. #
  442. procedure display()
  443.   static  oldy1,oldy2,oldy3,blanks
  444.   initial {
  445.           oldy1 := 5
  446.           oldy2 := 7
  447.           oldy3 := 9
  448.           blanks:= "       "
  449.           }
  450.   if leg1 = 2 then
  451.     {
  452.     writes(at(5,68),blanks)
  453.     writes(at(oldy1,68),blanks)
  454.     if y1 < 12 then
  455.       {
  456.       writes(at(y1,68),"  ",back[2],"  ")
  457.       writes(at(y1+1,68),"  1  ")
  458.       writes(at(y1+2,68),"  ",front[2],"  ")
  459.       }
  460.     oldy1 := y1
  461.     } else {
  462.     writes(at(y1,vectors[pos1]),back[leg1],1,front[leg1])
  463.     }
  464.  
  465.   if leg2 = 2 then
  466.     {
  467.     writes(at(7,68),blanks)
  468.     writes(at(oldy2,68),blanks)
  469.     if y2 < 14 then
  470.       {
  471.       writes(at(y2,69),"  ",back[2],"  ")
  472.       writes(at(y2+1,69),"  2  ")
  473.       writes(at(y2+2,69),"  ",front[2],"  ")
  474.       }
  475.     oldy2 := y2
  476.     } else {
  477.     writes(at(y2,vectors[pos2]),back[leg2],2,front[leg2])
  478.     }
  479.   if leg3 = 2 then
  480.     {
  481.     writes(at(9,68),blanks)
  482.     writes(at(oldy3,68),blanks)
  483.     if y3 < 16 then
  484.       {
  485.       writes(at(y3,70),"  ",back[2],"  ")
  486.       writes(at(y3+1,70),"  3  ")
  487.       writes(at(y3+2,70),"  ",front[2],"  ")
  488.       }
  489.     oldy3 := y3
  490.     } else {
  491.     writes(at(y3,vectors[pos3]),back[leg3],3,front[leg3])
  492.     }
  493.   end
  494.  
  495. #
  496. # simulate rare freakish accidents
  497. #
  498. procedure accident()
  499.   if (?2000 = 111) & (leg1 ~= 2) then
  500.     {
  501.     oops1 := 0
  502.     leg1 +:= 3
  503.     write(at(13,1),"\7OH NO! ",horse1[1]," fell down!")
  504.     }
  505.  
  506.   if (?2000 = 111) & (leg2 ~= 2) then
  507.     {
  508.     oops2 := 0
  509.     leg2 +:= 3
  510.     write(at(13,1),"\7OH NO! ",horse2[1]," fell down!")
  511.     }
  512.  
  513.   if (?2000 = 111) & (leg3 ~= 2) then
  514.     {
  515.     oops3 := 0
  516.     leg3 +:= 3
  517.     write(at(13,1),"\7OH NO! ",horse3[1]," fell down!")
  518.     }
  519.  
  520.   if oops1+oops2+oops3 = 0 then return 0
  521.   return 1
  522.   end
  523. #                             
  524. #
  525. # return a list of track x positions
  526. #
  527. procedure draw_track()
  528.   static  pavement
  529.   initial pavement := copy(mktrack())
  530.   offset     := []
  531.   every i    := 1  to 68       do put(offset,i)
  532.   every i    := 1  to 10       do put(offset,72)
  533.   every i    := 68 to 1  by -1 do put(offset,i)
  534.   offset  |||:= [1,1,1,1,1]
  535.   writes("\e[0;1;33;44m\e[2J\e[H")
  536.   every i := 1 to *pavement do
  537.     writes(at(i,1),pavement[i])
  538.   return offset
  539.   end
  540.  
  541. #
  542. # generate racing track
  543. #
  544. procedure mktrack()
  545.   track := []
  546.   put(track,"                 WELCOME TO ICON PARK CYBER STEED RACE TRACK")
  547.   put(track,"")
  548.   put(track,"___________________________________________________________________________")
  549.   put(track,"                                                                           \\")
  550.   put(track,"`#1#^                                                                       \\")
  551.   put(track,"                                                                             \\")
  552.   put(track,"`#2#^                                                                         \\")
  553.   put(track,"                                                                              |")
  554.   put(track,"`#3#^                                                                         |")
  555.   put(track,"_________________________________________________________________             |")
  556.   put(track,"                                                                 \\            |")
  557.   put(track,"Commentator:                                                      |           |")
  558.   put(track,"                                                                  |           |")
  559.   put(track,"_________________________________________________________________/            |")
  560.   put(track,"                                                                              |")
  561.   put(track,"                                                                              |")
  562.   put(track,"                                                                              /")
  563.   put(track,"                                                                             /")
  564.   put(track,"                                                                            /")
  565.   put(track,"                                                                           /")
  566.   put(track,"__________________________________________________________________________/")
  567.   put(track,"1  :")
  568.   put(track,"2  :")
  569.   put(track,"3  :")
  570.   return track
  571.   end
  572.  
  573. #
  574. # final wrapup procedure, summarize winnings
  575. #
  576. procedure done()
  577.   write("\e[2J\e[HICON PARK CYBER RACE TRACK BIDS YOU ADIEU\n")
  578.   write("    We all started with $100. And now for the results...\n")
  579.   every player := !players do
  580.     {
  581.     winnings := money[player]
  582.     if winnings < 100 then msg := "\nLooks like you lost some $ today.\n"
  583.     if winnings = 100 then msg := "\nLooks like you broke even today.\n"
  584.     if winnings > 100 then msg := "\nLooks like a winner. Stop at the IRS window please!\n"
  585.     write("OK ",player,", you have $",winnings," left. ",msg)
  586.     }
  587.   stop("Game Over.")
  588.   end
  589. #
  590. #
  591. # generate horse 1 portraite
  592. #
  593. procedure pick1()
  594.   pferd := []
  595.   put(pferd,"")
  596.   put(pferd,"                  /\\")
  597.   put(pferd,"              |||/  \\")
  598.   put(pferd,"             /       \\\\")
  599.   put(pferd,"            /        \\\\\\\\")
  600.   put(pferd,"           /   o     \\\\\\\\\\\\")
  601.   put(pferd,"          /          \\\\\\\\\\\\")
  602.   put(pferd,"         /           \\\\\\\\\\\\\\")
  603.   put(pferd,"        /               \\\\\\\\\\\\")
  604.   put(pferd,"       O     /-----\\     \\\\\\\\\\___")
  605.   put(pferd,"        \\/|_/       \\")
  606.   put(pferd,"                     \\")
  607.   put(pferd,"                      \\")
  608.   put(pferd,"                       \\")
  609.   return pferd
  610.   end
  611.  
  612. #
  613. # generate horse 2 portraite
  614. #
  615. procedure pick2()
  616.   pferd := []
  617.   put(pferd,"")
  618.   put(pferd,"                  /\\")
  619.   put(pferd,"              |||/  \\")
  620.   put(pferd,"             /       \\\\")
  621.   put(pferd,"            /  /     \\\\\\\\")
  622.   put(pferd,"           /   O      \\\\\\\\")
  623.   put(pferd,"          /            \\\\\\\\")
  624.   put(pferd,"         /              \\\\\\\\")
  625.   put(pferd,"        /                \\\\\\\\")
  626.   put(pferd,"        o     /----\\\\      \\\\\\\\\\___")
  627.   put(pferd,"         \\/|_/     \\\\")
  628.   put(pferd,"                   \\\\\\")
  629.   put(pferd,"                      \\")
  630.   put(pferd,"                       \\")
  631.   put(pferd,"")
  632.   return pferd
  633.   end
  634.  
  635. #
  636. # generate horse 3 portraite
  637. #
  638. procedure pick3()
  639.   pferd := []
  640.   put(pferd,"                    \\/          ")
  641.   put(pferd,"                   \\  /|||      ")
  642.   put(pferd,"                 \\       /      ")
  643.   put(pferd,"               \\\\        /     ")
  644.   put(pferd,"              \\\\\\     o   /   ")
  645.   put(pferd,"             \\\\\\\\          / ")
  646.   put(pferd,"            \\\\\\\\\\           / ")
  647.   put(pferd,"          \\\\\\\\\\               / ")
  648.   put(pferd,"      ___\\\\\\\\    \\\\-----/     O")
  649.   put(pferd,"                  \\\\       /_|/\\ ")
  650.   put(pferd,"                 \\               ")
  651.   put(pferd,"                \\                ")
  652.   put(pferd,"               \\                 ")
  653.   put(pferd,"")
  654.   return pferd
  655.   end
  656. #
  657. #
  658. # generate horse 4 portraite
  659. #
  660. procedure pick4()
  661.   pferd := []
  662.   put(pferd,"                    \\/           ")
  663.   put(pferd,"                   \\\\//|||       ")
  664.   put(pferd,"                 \\\\       /     ")
  665.   put(pferd,"               \\\\\\     /  /    ")
  666.   put(pferd,"              \\\\\\      O   /   ")
  667.   put(pferd,"             \\\\\\            /  ")
  668.   put(pferd,"            \\\\\\              / ")
  669.   put(pferd,"           \\\\\\                /")
  670.   put(pferd,"      ___\\\\\\      \\----/     o")
  671.   put(pferd,"                   \\\\     /_|/\\  ")
  672.   put(pferd,"                  \\\\             ")
  673.   put(pferd,"                 \\               ")
  674.   put(pferd,"                \\                ")
  675.   put(pferd,"")
  676.   return pferd
  677.   end
  678.  
  679. #
  680. # generate horse 5 portraite
  681. #
  682. procedure pick5()
  683.   pferd := []
  684.   put(pferd,"         /\\     /\\")
  685.   put(pferd,"        |  |||||  |")
  686.   put(pferd,"        |    |||  |")
  687.   put(pferd,"        |     ||  |\\")
  688.   put(pferd,"        |         | \\")
  689.   put(pferd,"        | 0     0 | |\\")
  690.   put(pferd,"        |         |  |\\")
  691.   put(pferd,"        |         |   |\\")
  692.   put(pferd,"        |         |    |\\")
  693.   put(pferd,"        |         |     |")
  694.   put(pferd,"        |  o   o  |\\")
  695.   put(pferd,"        \\  ____  /  \\")
  696.   put(pferd,"         \\______/    \\")
  697.   put(pferd,"")
  698.   return pferd
  699.   end
  700.  
  701. #
  702. # generate horse 6 portraite
  703. #
  704. procedure pick6()
  705.   pferd := []
  706.   put(pferd,"                 \\/     \\/ ")
  707.   put(pferd,"                |  |||||  |  ")
  708.   put(pferd,"                |  |||    |  ")
  709.   put(pferd,"               \\|  ||     | ")
  710.   put(pferd,"              \\ |         | ")
  711.   put(pferd,"             \\| | 0     0 | ")
  712.   put(pferd,"            \\|  |         | ")
  713.   put(pferd,"           \\|   |         | ")
  714.   put(pferd,"          \\|    |         | ")
  715.   put(pferd,"          |     |         |  ")
  716.   put(pferd,"               \\|  o   o  | ")
  717.   put(pferd,"              \\  /  ____  \\")
  718.   put(pferd,"             \\    /______\\ ")
  719.   put(pferd,"")
  720.   return pferd
  721.   end
  722.  
  723. procedure banner()
  724.   write("\e[0;1;33;44m\e[2J\e[H")
  725.   write("###############################################################################")
  726.   write("                                                                               ")
  727.   write("      ****  *   *  ****   *****  ****         ****  *****  *****  *****  ****  ")
  728.   write("    *       * *   *   *  *      *   *       *        *    *      *      *   *  ")
  729.   write("   *        *    ****   ***    ****         ***     *    ***    ***    *   *   ")
  730.   write("  *        *    *   *  *      * *             *    *    *      *      *   *    ")
  731.   write("  ****    *    ****   *****  *  *        ****     *    *****  *****  ****      ")
  732.   write("                                                                               ")
  733.   write("                         ****     *     ****  ***  *   *   ****                ")
  734.   write("                        *   *   * *   *       *   **  *  *                     ")
  735.   write("                       ****   *****  *       *   * * *  *  ***                 ")
  736.   write("                      * *    *   *  *       *   *  **  *   *                   ")
  737.   write("                     *  *   *   *   ****  ***  *   *   ****                    ")
  738.   write("                                                                               ")
  739.   write("   \e[1;5m               by tenaglia\e[0;1;33;44m")
  740.   write("                                                                               ")
  741.   write("###############################################################################")
  742.   wait(3)
  743.   end
  744. #
  745. #
  746. # move cursor to specified screen position
  747. #
  748. procedure at(row,column)
  749.   return "\e[" || row || ";" || column || "f"
  750.   end
  751.  
  752. #
  753. # procedure to wait n seconds
  754. #
  755. procedure wait(n)
  756.   secs := &clock[-2:0] + n
  757.   if secs > 60 then secs -:= 60
  758.   repeat
  759.     {
  760.     now := &clock[-2:0]
  761.     if now = secs then break
  762.     }
  763.   return
  764.   end
  765.  
  766. #
  767. # this procedure prompts for an input string
  768. #
  769. procedure input(prompt)
  770.   writes(prompt)
  771.   return read()
  772.   end
  773.  
  774. #
  775. # parse a string into a list with respect to a delimiter
  776. #
  777. procedure parse(line,delims)
  778.   static chars
  779.   chars  := &cset -- delims
  780.   tokens := []
  781.   line ? while tab(upto(chars)) do put(tokens,tab(many(chars)))
  782.   return tokens
  783.   end
  784.  
  785. ######################### END OF HORSE RACE GAME ###########################
  786.